
<title>任务管理</title>
<div class="layui-card layadmin-header">
	<div class="layui-breadcrumb" lay-filter="breadcrumb">
		<a lay-href="">定时任务</a>
		<!--<a><cite>定时任务</cite></a>-->
		<!--<a><cite>定时任务</cite></a>-->
	</div>
</div>
<div class="layui-fluid">
	<div class="layui-card padding-10" style="height: 60px;">
		<button type="button" style="margin-left: 15px;margin-top: 15px" class="layui-btn layui-btn-sm" id="createQuartzTask" >新建任务</button>
	</div>
</div>

<div class="layui-fluid">
	<div class="layui-card padding-10">
		<div id="quartz-task-div">
			<table id="quartz-task" lay-filter="quartzTask"></table>
			<script type="text/html" id="quartz-task-tools">
				<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon" style="padding-left: 2px">&#xe642;</i>  </button>
				<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon" style="padding-left: 2px">&#xe640;</i>  </button>
				<!-- 这里同样支持 laytpl 语法，如： -->
				<!--{{#  if(d.auth > 2){ }}
				<a class="layui-btn layui-btn-xs" lay-event="check">审核</a>
				{{#  } }}-->
			</script>
		</div>
	</div>
</div>
<script>
	
	layui.use('mail/quartz/quartzTask', layui.factory('mail/quartz/quartzTask'));

	layui.use(['form','table','admin'],function () {

        var $ = layui.jquery;
        var admin = layui.admin;

        $("#createQuartzTask").click(function () {
            admin.popup({
                type:2,
                title:'新增任务',
                area:['600px','850px'],
                anim:3,
                fixed:false,
                resize:false,
                scrollbar:false,
                content:['../src/views/mail/quartz/add.html','no'],
                end:function () {
                    var quartzTaskRuleData = {
                        "id":null,
//                        "methodName":,
                    };
                    quartzTaskRuleTableReload ();
                }
			})
//            layer.open({
//
//            });
        });

        function quartzTaskRuleTableReload(){
            var quartzTaskRuleData = null;
            layui.use(['table','jquery'],function () {
                var table = layui.table;
                table.reload('quartz-task', {
                    url:layui.setter.url+'/mail/task/getOrderJobList',
                    where: { //设定异步数据接口的额外参数，任意设
                        'access_token': layui.data('layuiAdmin').access_token,
                        quartzTaskRuleData: quartzTaskRuleData
                    }
                });
            });
        }
        
        function mailDetail(data) {
            layui.data('mailData', {
                key: 'data'
                , value: data
            }),
                layer.open({
                    type:2,
                    title:'订单同步规则修改',
                    area:['550px','800px'],
                    anim:3,
                    fixed:false,
                    resize:false,
                    scrollbar:false,
                    content:['../src/views/mail/quartz/edit.html','no'],
                    end:function () {

                        //修改后原本状态是激活的再恢复任务
                        // if(status=="start"){
                        //     clickEditUpdateStatusTask(data.id,status);
                        // }

                        var quartzTaskRuleData = {
                            "id":null,
                            "methodName":"quartzTask"
                        };
                        quartzTaskListRender();
                    }
                });
        }
    });


</script>